﻿using System.Web.UI;

namespace Eneta.Portal.Forum.Common.Controls
{
    public class OWSRichTextField : OWSBase
    {
        // Methods
        protected override void Render(HtmlTextWriter wtr)
        {
            wtr.Write("<SCRIPT>fld = new RichTextField(frm, \"{0}\", \"{1}\", \"{2}\");fld.fAllowHyperlink = false; fld.WebLocale = \"1033\"; fld.stNumLines = \"{3}\"; fld.fRequired = {4};fld.IMEMode = \"\"; fld.BuildUI();</SCRIPT>", new object[] { this.UniqueID, base.Display, base.JavaScriptValue, this.NumLines, base.Required.ToString().ToLower() });
            wtr.Write("&nbsp;<br><SPAN class=ms-formdescription ID={0}>{1}</SPAN>", this.UniqueID, this.Description);
        }

        // Properties
        public int NumLines
        {
            get
            {
                if (this.ViewState["NumLines"] == null)
                {
                    this.NumLines = 5;
                }
                return (int)this.ViewState["NumLines"];
            }
            set
            {
                this.ViewState["NumLines"] = value;
            }
        }
    }

}
